import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  }).then(res => {
    return res
  })
}

export function logList(data) {
  return request({
    url: '/log/page',
    method: 'post',
    data
  }).then(res => {
    return res
  })
}

export function userAdd(data) {
  return request({
    url: '/user',
    method: 'post',
    data
  }).then(res => {
    return res
  })
}

export function userPut(data) {
  return request({
    url: '/user',
    method: 'put',
    data
  }).then(res => {
    return res
  })
}

export function userPasswordPut(data) {
  return request({
    url: '/user/password',
    method: 'put',
    data
  }).then(res => {
    return res
  })
}

export function getInfo(token) {
  return request({
    url: '/user/userinfo',
    method: 'get',
    params: { token }
  }).then(res => {
    console.log(res)
    return res
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'get'
  }).then(res => {
    return res
  })
}

export function userDel(data) {
  return request({
    url: '/user',
    method: 'delete',
    data
  }).then(res => {
    return res
  })
}

export function userDel1(data) {
  return request({
    url: '/user',
    method: 'delete',
    data
  }).then(res => {
    return res
  })
}

export function assetsExport(data) {
  return request({
    url: '/log/export',
    method: 'post',
    data
  }).then(res => {
    return res
  })
}
